package cn.hpclub.server.service;

import java.util.concurrent.ConcurrentHashMap;

import cn.hpclub.server.util.QueryHelper;

public class SpreadMemberRegService{

    public static final SpreadMemberRegService service = new SpreadMemberRegService();

    public QueryHelper getListHelper(ConcurrentHashMap<String, String> searchInfo){
        QueryHelper helper = new QueryHelper("select sr.id as id,sr.name as my_name,sr.emp_code as my_emp_code,sr.*,mo.*,mo.emp_code as parent_emp_code,mo.name as parent_name,sr.reg_time as spread_reg_time", "spreader_register sr left join member_org mo on sr.parent_user_id = mo.id");
        helper.addCondition(searchInfo.containsKey("name"),"sr.name like ?","%"+searchInfo.get("name")+"%");
        helper.addCondition(searchInfo.containsKey("parent_name"),"mo.name like ?","%"+searchInfo.get("parent_name")+"%");
        helper.addCondition(searchInfo.containsKey("emp_code"),"sr.emp_code=?",searchInfo.get("emp_code"));
        helper.addCondition(searchInfo.containsKey("parent_emp_code"),"mo.emp_code=?",searchInfo.get("parent_emp_code"));
        return helper;
    }

}
